home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Toolbars and Status Bars / SimpleStatusBarWithPanel / SimpleStatusBarWithPanel.cs next >
Encoding:
Text File  |  2001-01-15  |  1.4 KB  |  48 lines

  1. //-------------------------------------------------------
  2. // SimpleStatusBarWithPanel.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class SimpleStatusBarWithPanel: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new SimpleStatusBarWithPanel());
  13.      }
  14.      public SimpleStatusBarWithPanel()
  15.      {
  16.           Text = "Simple Status Bar with Panel";
  17.  
  18.                // Create panel.
  19.  
  20.           Panel panel = new Panel();
  21.           panel.Parent = this;
  22.           panel.BackColor = SystemColors.Window;
  23.           panel.ForeColor = SystemColors.WindowText;
  24.           panel.AutoScroll = true;
  25.           panel.Dock = DockStyle.Fill;
  26.           panel.BorderStyle = BorderStyle.Fixed3D;
  27.  
  28.                // Create status bar as child of form.
  29.  
  30.           StatusBar sb = new StatusBar();
  31.           sb.Parent = this;
  32.           sb.Text = "My initial status bar text";
  33.  
  34.                // Create labels as children of panel.
  35.  
  36.           Label label = new Label();
  37.           label.Parent = panel;
  38.           label.Text = "Upper left";
  39.           label.Location = new Point(0, 0);
  40.  
  41.           label = new Label();
  42.           label.Parent = panel;
  43.           label.Text = "Lower right";
  44.           label.Location = new Point(250, 250);
  45.           label.AutoSize = true;
  46.      }
  47. }
  48.